<include file="./Admin/Tpl/Index/header.html"/>			

<include file="./Admin/Tpl/Index/left.html"/>	


<script>

window.onload=function(){
var m = document.getElementById('selectResult');
 for(i=0;i<=m.options.length;i++)
 {  
  if(m.options[i].value=="<{$_GET['isexchange']}>")
  {      
   m.options[i].selected=true;   
   break;
  }
 }
}
			
function is_sure()
{
	if(confirm("确定要兑换吗？"))
	{
	    return true;
	}
	else
	{
	    return false;
	}
}

				$(function(){
				
				//提交表单
				$('img.search').click(function(){
					$('form[name="searchUserForm"]').submit();
				});
				
				$('#exportData').click(function(){
					
					
					var userphone='blank';
					var username='blank';
					var isexchange='blank';
					
					if($("#userphone").val()!=''){
						userphone =$("#userphone").val();
					}
					if($("#username").val()!=''){
						username =$("#username").val();
					}
					if($("#selectResult").val()!=''){
						isexchange =$("#selectResult").val();
					}

					window.location.href = "__APP__/User/exportUserData/userphone/"+userphone+"/username/"+username+"/isexchange/"+isexchange;
				});
			});
		</script>		
	<div class="diywap_right">

		<div class="well well-sm">用户记录查询</div>
					
					<form  name="searchUserForm" action="__APP__/User/searchUser"  method="get" >
		<div>
		
			联系人:<input type='text' name='username' id="username" value="<{$_GET['username']}>"/>
			联系电话: <input type='text' name='userphone' id="userphone" value="<{$_GET['userphone']}>"/>
			是否兑换: <select name="isexchange" id="selectResult">  
		    	<option value="">请选择</option>  
		        <option value="1">已兑换</option> 
		        <option value="0">未兑换</option>	        
	       </select> 		 
			<button type="submit" class="btn btn-primary btn-lg" id="search">查询</button>
			
			<div class="btn btn-primary btn-lg" id="exportData" >导出数据</div>
			
		</div>
		</form>
		</br>
		
		<table class="table table-hover table-bordered">
			<tr>
				<th>序号</th>
				<th>用户姓名</th>
				<th>用户电话</th>
				<th>是否兑换</th>
				<th>注册时间</th>
				<!-- <th>领奖码</th> -->
				<!-- <th>状态</th> -->
			</tr>
			<volist name='data' id='vo'>
				<tr class="active">
					<td><{$i}></td>
					<td><{$vo.username}></td>
					<td><{$vo.userphone}></td>
					<td><if condition="$vo.is_exchange eq 0 "><a href='__APP__/User/doExchangeNew/uid/<{$vo.id}>' onClick='return is_sure();'>未兑换</a>
					    <elseif condition="$vo.is_exchange eq 1"/>已兑换&nbsp;
					    <else />&nbsp;
					    </if></td>
					<td><{$vo.regtime}></td>
					<!-- <td>
					    <if condition="$vo.sncode eq '' ">未领取
					    <else /><{$vo.sncode}>
					    </if>
					</td> -->
					<!-- <td>
					    <if condition="$vo.is_exchange eq 0 ">未领奖
					    <elseif condition="$vo.is_exchange eq 1"/>已领奖&nbsp;<{$vo.giftname}>
					    <else />&nbsp;
					    </if>
					</td> -->
				</tr>
			</volist>

		</table>
		
		</br>
		<div style="text-align:center;"><{$page}></div>

			</div>

		

</div>

</body>

</html>